﻿using Api.WDS.Operate;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Api.WDS.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class AccountController : ControllerBase
    {
        /// <summary>
        /// 用户注册
        /// </summary>
        /// <returns></returns>
        [HttpPost("Register")]
        public IActionResult Register()
        {
            var pwd = HttpContext.Request.Form["Pwd"];
            var mail = HttpContext.Request.Form["Mail"];
            var code = HttpContext.Request.Form["Code"];

            return Ok(new AccountOp().UserRegister(pwd, mail, code));
        }

        /// <summary>
        /// 获取邮箱验证码
        /// </summary>
        /// <returns></returns>
        [HttpGet("MailCode")]
        public IActionResult MailCode()
        {
            var mail = HttpContext.Request.Query["Mail"];

            return Ok(new AccountOp().SendMailCode(mail));
        }
    }
}
